#include <iostream>
#include <windows.h>
#include <Xinput.h>
using namespace std;

int main()
{
    XINPUT_STATE state;
    int result;
    
    while(true)
    {
        ZeroMemory(&state,sizeof(state));
        result = ::XInputGetState(0,&state);
        
        if(result == ERROR_SUCCESS)
        {
            cout << state.Gamepad.sThumbLX << endl;
            cout << state.Gamepad.sThumbLY << endl;
            cout << state.Gamepad.sThumbRX << endl;
            cout << state.Gamepad.sThumbRY << endl;
            cout << (int)state.Gamepad.bLeftTrigger << endl;
            cout << (int)state.Gamepad.bRightTrigger << endl;
        }else
        {
            cout << "Controller not connected" << endl;
        }
        
        Sleep(200);
    }
    
    return 0;
}
